﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace SevenInvaders.LEVEL_JACK
{
    class Jack_M_Pieces
    {
        public Texture2D texture1;
        public Vector2 position1;

        public Texture2D texture2;
        public Vector2 position2;

        public Texture2D texture3;
        public Vector2 position3;

        public Texture2D texture4;
        public Vector2 position4;

        public Texture2D texture5;
        public Vector2 position5;

        public bool Visible1;
        public bool Visible2;
        public bool Visible3;
        public bool Visible4;
        public bool Visible5;

        public Rectangle Collision1;
        public Rectangle Collision2;
        public Rectangle Collision3;
        public Rectangle Collision4;
        public Rectangle Collision5;

        public static List<Jack_M_Pieces> list = new List<Jack_M_Pieces>();

        public Jack_M_Pieces(Texture2D myTex1, Vector2 myPos1, Texture2D myTex2, Vector2 myPos2,
            Texture2D myTex3, Vector2 myPos3, Texture2D myTex4, Vector2 myPos4, Texture2D myTex5, Vector2 myPos5)
        {
            Visible1 = true;
            Visible2 = true;
            Visible3 = true;
            Visible4 = true;
            Visible5 = true;

            texture1 = myTex1;
            position1 = myPos1;

            texture2 = myTex2;
            position2 = myPos2;

            texture3 = myTex3;
            position3 = myPos3;

            texture4 = myTex4;
            position4 = myPos4;

            texture5 = myTex5;
            position5 = myPos5;
        }

        public void Update(GameTime gameTime)
        {
            position1.X -= 2;
            position1.Y -= 2;

            position2.X += 2;
            position2.Y -= 1;

            position3.X -= 2;
            position3.Y += 2;

            position4.X += 1;
            position4.Y += 2;

            position5.X += 2;
            position5.Y += 1;

            Collision1 = new Rectangle((int)position1.X, (int)position1.Y, texture1.Width, texture1.Height);
            Collision2 = new Rectangle((int)position2.X, (int)position2.Y, texture2.Width, texture2.Height);
            Collision3 = new Rectangle((int)position3.X, (int)position3.Y, texture3.Width, texture3.Height);
            Collision4 = new Rectangle((int)position4.X, (int)position4.Y, texture4.Width, texture4.Height);
            Collision5 = new Rectangle((int)position5.X, (int)position5.Y, texture5.Width, texture5.Height);
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            if (Visible1)
            {
                spriteBatch.Draw(texture1, position1, Color.White);
            }
            if (Visible2)
            {
                spriteBatch.Draw(texture2, position2, Color.White);
            }
            if (Visible3)
            {
                spriteBatch.Draw(texture3, position3, Color.White);
            }
            if (Visible4)
            {
                spriteBatch.Draw(texture4, position4, Color.White);
            }
            if (Visible5)
            {
                spriteBatch.Draw(texture5, position5, Color.White);
            }
        }
    }
}
